package com.lyfx.search.controller;

import com.lyfx.common.exception.BizCodeEnum;
import com.lyfx.common.to.es.CourseModel;
import com.lyfx.common.utils.R;
import com.lyfx.search.service.CourseSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lsy
 * @create 2020-07-25-13:06
 */
@RestController
@RequestMapping("/search/save")
public class ElasticSaveController {

    @Autowired
    CourseSaveService courseSaveService;

    //上架课程
    @PostMapping("/course")
    public R courseStatusUp(@RequestBody List<CourseModel> courseModel){
        boolean b = courseSaveService.courseStatusUp(courseModel);
        if(b){
            return R.ok();
        }
        return R.error(BizCodeEnum.COURSE_UP_EXCEPTION.getCode(),BizCodeEnum.COURSE_UP_EXCEPTION.getMsg());
    }



}
